package com.youhome.common.queue;

import java.util.LinkedList;
import java.util.Queue;

/**
 * Created by chen365 on 2017/8/31.
 */
public class CompanyReportQueueList {
    private static Queue<Object> companyReportQueue = new LinkedList<>();

    public synchronized static void push(Object entity) {
        companyReportQueue.offer(entity);
    }

    public synchronized static void push(LinkedList<Object> list) {
        System.err.println("加入队列...");
        for (Object entity : list) {
            companyReportQueue.offer(entity);
        }
    }

    public synchronized static Object get() {
        synchronized (companyReportQueue) {
            if (!companyReportQueue.isEmpty())
                return companyReportQueue.poll();
        }
        return null;
    }

    public static boolean isEmpty() {
        synchronized (companyReportQueue) {
            if (!companyReportQueue.isEmpty())
                return true;
        }
        return false;
    }

    public static int size() {
        return companyReportQueue.size();
    }
}
